program eva;
type gg=set of byte;
var a1,a2,a3:array[1..40] of integer;
    k,n,max,site,g,f,site1,site2,code,total:integer;
    old:set of byte;
    str1,str2,inputstr:string;
function shinji(ge:gg):integer;
var d:integer;
    s1:string;
begin
  d:=0;
  repeat
    inc(d);
  until not(d in ge);
  shinji:=d-1;
end;
function rei(k:integer):integer;
var i,j,d,m:integer;
    s,s1:string;
    ge:gg;
begin
  i:=1;ge:=[];
  for j:=1 to n do
    a1[j]:=-1;
  while i>0 do
    begin
      if i>n then
        begin
          m:=0;
          for d:=1 to n do
            m:=m+a2[a1[d]];
          ge:=ge+[m];
          i:=i-1;
        end
       else
         begin
            inc(a1[i]);
            if a1[i]>k then
              begin
                a1[i]:=-1;
                i:=i-1;
              end
            else
             begin
               inc(i);
               a1[i]:=a1[i-1]-1;
             end;
         end;
    end;
  rei:=shinji(ge);
end;
begin
  readln(inputstr);
   site1:=pos('N=',inputstr)+2;
  site2:=pos('k=',inputstr)+2;
  val(copy(inputstr,site1,site2-3-site1),n,code);
  val(copy(inputstr,site2,length(inputstr)-site2+1),k,code);
  site:=1;
  for f:=1 to k do
    a2[f]:=0;
  old:=[];
  while site>0 do
    begin
      if site>k then
        begin
          total:=a3[k];
          if total>max then
           begin
            max:=total;
            str1:='';
            for g:=1 to k do
              begin
               str(a2[g],str2);
               str1:=str1+' '+str2;
              end;
           end;
          site:=site-1;
        end
      else
        begin
          old:=old-[a2[site]];
          inc(a2[site]);
          while a2[site] in old do
             inc(a2[site]);
          a3[site]:=rei(site);
          if a2[site]>a3[site-1]+1 then
            begin
              a2[site]:=0;
              site:=site-1;
            end
          else
            begin
              old:=old+[a2[site]];
              inc(site);

            end;
        end;
    end;
  writeln(str1);
  writeln('max=',max);
end.
